package com.question.entity;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.MapKeyColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.achievement.entity.Subject;

@Entity
@Table(name="t_blank")
public class Blank  implements Serializable{
	private Long id;
	private String num;
	private String title;
	private Subject subject;
	private boolean compreh;
	private Map<Integer, Options> blanks = new HashMap<Integer, Options>();
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	@Column(length=8000)
	public String getTitle() {
		return title;
	}
	@OneToMany(fetch=FetchType.EAGER,cascade=CascadeType.ALL)
	@JoinTable(name="t_blank_options",inverseJoinColumns=@JoinColumn(name="option_id"))
	@MapKeyColumn(name="blank_key")
	public Map<Integer, Options> getBlanks() {
		return blanks;
	}
	public String getNum() {
		return num;
	}
	@ManyToOne(fetch=FetchType.EAGER)
	public Subject getSubject() {
		return subject;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public void setBlanks(Map<Integer, Options> blanks) {
		this.blanks = blanks;
	}
	public void setNum(String num) {
		this.num = num;
	}
	public void setSubject(Subject subject) {
		this.subject = subject;
	}
	public boolean isCompreh() {
		return compreh;
	}
	public void setCompreh(boolean compreh) {
		this.compreh = compreh;
	}
	
	
}
